<?php

class DeletePasswordForm extends AbstractForm {
	const NAME = 'delete';

	public function process() {
		return KeyGenius::deletePassword($this->getValue('token'), $this->getValue('id'));
	}

	public function getTitle() {
		return 'Delete password';
	}

	public function getDescription() {
		return 'Delete this password.';
	}

	public function configure() {
		$this->setWidgets(array(
			'id'		=> new sfWidgetFormInput(array('is_hidden' => true, 'type' => 'hidden')),
			'token'		=> new sfWidgetFormInput(),
		));

		$this->widgetSchema->setNameFormat(self::NAME.'[%s]');

		$this->setValidators(array(
			'id'		=> new sfValidatorInteger(),
			'token'		=> new sfValidatorRegex(array('pattern' => self::OTP_PATTERN)),
		));
	}
}

?>
